<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue表单</title>
    <script type="text/javascript" src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>

<div id="app">
    <form>
        <!--打印列表-->
        <fieldset>
            <legend>你想要使用哪些打印机?</legend>
            <label>
                <input type="checkbox" v-model="outputPrinter" value="单色"/>
                单色</label><br>
            <label>
                <input type="checkbox" v-model="outputPrinter" value="等离子体颜色"/>
                等离子体颜色</label><br>
            <label>
                <input type="checkbox" v-model="outputPrinter" value="3D打印"/>
                3D打印</label><br>
            <input type="submit" value="打 印" @click.prevent="printHandler"/>
        </fieldset>
    </form>
</div>

<script>
    new Vue({
        el: '#app',
        data: {
            outputPrinter: []
        },
        methods: {
            printHandler () {
                let printers = this.outputPrinter
                alert('打印: ' + (printers.length ? printers.join(', ') : 'none') + '.')
            }
        }
    });
</script>
</body>
</html>